﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Media.Animation;

namespace WGMClient.Controls
{
    /// <summary>
    /// Interaction logic for GlassButton.xaml
    /// </summary>
    public partial class GlassButton : UserControl
    {
        public GlassButton()
        {
            InitializeComponent();
           

        }
        Point tempPoint = new Point();

        private void LayoutRoot_MouseMove(object sender, MouseEventArgs e)
        {

            Point p = e.GetPosition(this);
            tempPoint.X = p.X / ActualWidth;
            tempPoint.Y = 1;
            _brushLight.Center = tempPoint;
            _brushLight.GradientOrigin = tempPoint;

        }
        public Thickness ImageMargin
        {
            get { return _imgItem.Margin; }
            set { _imgItem.Margin = value; }
        }
        string _title = String.Empty;

        /// <summary>
        /// Title of the toolbar item
        /// </summary>
        public string Title
        {
            get { return _title; }
            set { _title = value; }
        }


        /// <summary>
        /// The transition color when we hover over the button
        /// </summary>
        public Color TransitionColor
        {
            get
            {
                return transitionColor.Color;
            }
            set
            {
                transitionColor.Color = value;
                transitionSubColor.Color = Color.FromArgb(64, value.R, value.G, value.B);
            }
        }

        /// <summary>
        /// The source of the image to display for the control
        /// </summary>
        public ImageSource ImageSource
        {
            get { return _imgItem.Source; }
            set { _imgItem.Source = value; }
        }

        private void LayoutRoot_MouseEnter(object sender, MouseEventArgs e)
        {
            _brushLight.Opacity = 1;
        }

        private void LayoutRoot_MouseLeave(object sender, MouseEventArgs e)
        {

            _brushLight.Opacity = 0;
            
        }
    }
}
